<template>
  <a-card :bordered="false">


    <!-- table区域-begin -->
    <div>

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :loading="loading"
        :rowSelection="{ type: 'radio', selectedRowKeys: selectedRowKeys,onChange: onSelectChange }"
        class="j-table-force-nowrap">

      </a-table>
    </div>

  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import {getSpHistory} from '@api/apiStreamPlat'

  export default {
    name: 'SavepointBackupList',
    components: {
    },
    data () {
      return {
        description: 'savepoint_backup管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'jobConfigId',
            align:"center",
            dataIndex: 'jobConfigId'
          },
          {
            title:'地址',
            align:"center",
            dataIndex: 'savepointPath'
          },
          {
            title:'备份时间',
            align:"center",
            dataIndex: 'backupTime'
          },
          {
            title:'creator',
            align:"center",
            dataIndex: 'creator'
          },
        ],
        dictOptions:{},
        superFieldList:[],
        loading:false,
        selectedRowKeys:[],
        dataSource:[]
      }
    },

    methods: {
      queryList(jobConfigId){
        let params = {}
        params.jobConfigId = jobConfigId
        this.loading = true;
        getSpHistory(params).then((res) => {
          if (res.success) {
            this.dataSource = res.result;
          }
          this.loading = false
        })
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows;
        this.$emit("getSavePointId",selectedRowKeys[0])
      },

    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>